import Vue from 'vue'
//引入路由插件
import VueRouter from 'vue-router'
//加载首页,首页不需要懒加载
import Movie from '../views/home/Movie.vue'

//使用路由插件
Vue.use(VueRouter)
//定义路由表
const routes = [
  {
    path:"/",
    redirect: "/home"
  },
   {
    path: '/home',
    name: 'Movie',
    component: Movie,
    children:[
      {path:'/home',redirect: '/home/reying'},
      {path:"reying",name:"reying",component: () => import(/* webpackChunkName: "reying" */ '../views/home/Reying.vue')},
      {path:"yingyuan",name:"yingyuan",component: () => import(/* webpackChunkName: "yingyuan" */ '../views/home/Yingyuan.vue')},
      {path:"daiying",name:"daiying",component: () => import(/* webpackChunkName: "daiying" */ '../views/home/Daiying.vue')},
      {path:"jingdian",name:"jingdian",component: () => import(/* webpackChunkName: "jingdian" */ '../views/home/Jingdian.vue')}
    ]
  },
  {
    path: '/video',
    name: 'Video',
    //路由懒加载 当触发点击跳转到这一页时，才加载这一页的组件 
    component: () => import(/* webpackChunkName: "video" */ '../views/Video.vue')
  },
  {
    path: '/minivideo',
    name: 'MiniVideo',
    component: () => import(/* webpackChunkName: "minivideo" */ '../views/MiniVideo.vue')
  },
  {
    path: '/show',
    name: 'Show',
    component: () => import(/* webpackChunkName: "show" */ '../views/Show.vue')
  },
  {
    path: '/me',
    name: 'Me',
    component: () => import(/* webpackChunkName: "me" */ '../views/Me.vue')
  },
   {
    path: '/item/:id',//需要传递参数
    name: 'Item',
    component: () => import(/* webpackChunkName: "item" */ '../views/Itme.vue')
  },
  {
    path: '/city',//需要传递参数
    name: '/Citylist',
    component: () => import(/* webpackChunkName: "404" */ '../views/Citylist.vue')
  }, {
    path: '*',//需要传递参数
    name: '/Cant',
    component: () => import(/* webpackChunkName: "404" */ '../views/home/Cant.vue')
  }
]
//创建路由实例
const router = new VueRouter({
  // mode:"hash",
  routes
})

export default router